package com.zg.util;

import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.core.JsonParser.Feature;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;

import java.math.BigDecimal;

/**
 * 该类用于提供一些类似的单例的，无状态的对象
 * @author 王利东
 */
public class SingletonObject {
	
	public static final ObjectMapper objectMapper = new ObjectMapper();
	
	public static final BigDecimal HUNDRED = new BigDecimal(100);
	
	static {
		objectMapper.configure(Feature.ALLOW_UNQUOTED_CONTROL_CHARS, true);//允许出现特殊字符和转义符
		objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
		objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
		objectMapper.configure(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES, true);
		objectMapper.setSerializationInclusion(Include.NON_ABSENT);
	}

}